package com.zx.map.dao.impl;

import com.zx.map.dao.BalanceSummaryDao;
import com.zx.map.dao.mapper.BalanceSummaryMapper;
import com.zx.map.dao.model.BalanceSummary;
import com.zx.map.dao.model.BalanceSummaryExample;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Component;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Administrator
 * Date: 14-3-1
 * Time: 上午10:54
 * To change this template use File | Settings | File Templates.
 */
@Component("BalanceSummaryDao")
public class BalanceSummaryImpl implements BalanceSummaryDao {

    @Autowired
    private BalanceSummaryMapper mapper;

    @Override
    public Integer add(BalanceSummary balanceSummary) throws DataAccessException {
        int column = mapper.insert(balanceSummary);
        if (column != 1) {
            throw new RuntimeException("");
        }
        return balanceSummary.getId();
    }

    @Override
    public List<BalanceSummary> getListByExample(BalanceSummaryExample example) {
        return mapper.selectByExample(example);
    }
}
